package com.pengshun.modules.api.user.repository;

import com.pengshun.modules.domain.CarDriving;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;

import java.util.List;


public interface CarDrivingRepository extends JpaRepository<CarDriving, Long>, JpaSpecificationExecutor<CarDriving> {

    CarDriving findByCarOwnerIdAndOwnerDrivingId(Long carOwnerId,Long  ownerDrivingId);

    /**
     * 查询车辆绑定的所有司机
     * @param carOwnerId
     * @return
     */
    List<CarDriving> findByCarOwnerId(Long carOwnerId);

    /**
     * 查询司机绑定的车辆
     * @param ownerDrivingId
     * @param
     * @return
     */
    List<CarDriving> findByOwnerDrivingId(Long ownerDrivingId);

    void deleteByOwnerDrivingId(Long ownerDrivingId);
}
